#-------------------------------------------------------------------------------
#Here, we build the files that will be used to create the library Cbc
#-------------------------------------------------------------------------------
FILE(GLOB CBC_SRCS
     ${CBC_ROOT_DIR}/Cbc/src/*.cpp
)

#-------------------------------------------------------------------------------
#Here, we build the files that will be used to create the library CbcSolver
#-------------------------------------------------------------------------------
SET(CBCSOLVER_SRCS
    ${CBC_ROOT_DIR}/Cbc/src/CbcCbcParam.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/Cbc_ampl.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/CbcLinked.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcLinkedUtils.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/unitTestClp.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcSolver.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/CbcSolverHeuristics.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/CbcSolverAnalyze.cpp
	  ${CBC_ROOT_DIR}/Cbc/src/CbcSolverExpandKnapsack.cpp
)

#-------------------------------------------------------------------------------
#Here, we build the files that will be used to create the generic Cbc solver
#-------------------------------------------------------------------------------
SET(CBCGENERIC_SRCS
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenBaB.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenCbcParam.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenCbcParamUtils.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenCtlBlk.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGeneric.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenMessages.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenOsiParam.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenOsiParamUtils.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenParam.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenParamUtils.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenSolution.cpp
    ${CBC_ROOT_DIR}/Cbc/src/CbcGenSolvers.cpp
)

#-------------------------------------------------------------------------------
#Here, we build the files that will be used to create the OsiCbc library
#-------------------------------------------------------------------------------
FILE(GLOB OSICBC_SRCS
     ${CBC_ROOT_DIR}/Cbc/src/OsiCbc/*.cpp
)
    
#-------------------------------------------------------------------------------
#Exclude CbcSolver files from Cbc
#-------------------------------------------------------------------------------
FOREACH(B_SRC ${CBCSOLVER_SRCS})
  #Remove CbcSolver files
  LIST(REMOVE_ITEM CBC_SRCS "${B_SRC}")
ENDFOREACH(B_SRC ${CBCSOLVER_SRCS})

#-------------------------------------------------------------------------------
#Exclude CbcGeneric files from Cbc
#-------------------------------------------------------------------------------
FOREACH(B_SRC ${CBCGENERIC_SRCS})
  #Remove CbcGeneric files
  LIST(REMOVE_ITEM CBC_SRCS "${B_SRC}")
ENDFOREACH(B_SRC ${CBCSOLVER_SRCS})

#Exclude the CoinSolve.cpp file
LIST(REMOVE_ITEM CBC_SRCS 
     "${CBC_ROOT_DIR}/Cbc/src/CoinSolve.cpp"
     "${CBC_ROOT_DIR}/Cbc/src/unitTest.cpp")

#-------------------------------------------------------------------------------
#and build the libraries (Cbc, CbcSolver and OsiCbc)
#-------------------------------------------------------------------------------
ADD_LIBRARY(COIN_Cbc ${CBC_SRCS})
ADD_LIBRARY(COIN_CbcSolver ${CBCSOLVER_SRCS})
ADD_LIBRARY(COIN_OsiCbc ${OSICBC_SRCS})
INSTALL(
  TARGETS
    COIN_Cbc COIN_CbcSolver COIN_OsiCbc
  ARCHIVE DESTINATION 
    lib
)

